package com.sams.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sams.entity.EduManage;
import com.sams.entity.EduManageExample;
import com.sams.entity.EduManageExample.Criteria;
import com.sams.mapper.EduManageMapper;
import com.sams.service.EduManageService;

@Service
public class EduManageServiceImpl implements EduManageService{
	
	@Autowired
	private EduManageMapper mapper;
	//分页
	public PageInfo<EduManage> listEduManage(int currentPage) {
		PageHelper.startPage(currentPage, 20);   
		
		  EduManageExample example = new EduManageExample();
		 Criteria createCriteria = example.createCriteria();
		 
		  //设置条件  xue
		 //createCriteria.andIdEqualTo(1);
		 
		// System.out.println("====="+mapper);
		List<EduManage> list =  mapper.selectByExample(example);
		
		
		PageInfo<EduManage> pageInfo = new PageInfo<EduManage>(list);
		//System.out.println("当前页："+pageInfo.getPageNum());
		//System.out.println("总记录数："+pageInfo.getPageSize());
		//System.out.println(pageInfo);
		 
		return pageInfo;
	}
	//添加
	public int add(EduManage edu) {
		return mapper.insert(edu);
	}
	//修改
	public int update(EduManage edu) {
		return mapper.updateByPrimaryKey(edu);
	}
	//删除
	public int delete(int id) {
		return mapper.deleteByPrimaryKey(id);
	}
	public EduManage findById(int id) {
		return mapper.selectByPrimaryKey(id);
	}

}
